home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Language/OS - Multiplatform Resource Library
/
LANGUAGE OS.iso
/
lisp
/
eulisp
/
mpfeel.lha
/
MPFeel
/
Modules
/
fact.em
< prev
next >
Wrap
Lisp/Scheme
|
1992-10-06
|
621b
|
20 lines
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; EuLisp Module Copyright (C) University of Bath 1991 ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defmodule fact
(standard) ()
(defun fact (n) (if (= n 0) 1 (* (fact (- n 1)) n)))
(defun rfact (n) (rfact-aux n 1))
(defun rfact-aux (n tot)
(cond ((= n 0) tot)
(t (rfact-aux (- n 1) (* n tot)))))
)